#pragma once

class CPiovtIndex
{
public:
	static int ExePiovtIndex(int nums[], int Length)
	{
		if (Length <= 2)
		{
			return -1;
		}
		//Array Sum
		int Sumnum = 0;
		for (int i = 0; i < Length; i++)
		{
			Sumnum += nums[i];
		}

		int LeftSum = 0;
		for (int i = 0; i < Length; i++)
		{
			LeftSum += nums[i];
			if (LeftSum == Sumnum)
			{
				return i;
			}
			Sumnum -= nums[i];
		}
		return -1;
	}
};

